<template>
	<view>
		<view style='padding:10px 15px'>
			<u-search placeholder="请输入查询条件" v-model="keyword" shape="round" :showAction="true" actionText="搜索"
				:animation="false" height='60' style='width:100%' @focus='focusSearch'></u-search>
		</view>
		<view class="planAudit">
			<view style="border-top: 1px #E7E7E7 solid;padding: 0 0 0 20px;">
				<u-tabs :list="list1" @click='recordClick' lineWidth="40" lineHeight="6" lineColor="#108EEF"
					:activeStyle="{
				    color: '#303133',
				    fontWeight: 'bold',
				    transform: 'scale(1.05)'
				}"></u-tabs>
			</view>
			<view class="planAudit_project" v-for="(item,index) in checkTask">
				<view class="planAudit_project_title">
					<image class='planAudit_project_img' src="/static/dailySupervision/tjbg.png" alt=""></image>
						<text>{{item.taskName}}</text>
				</view>
				<view class="planAudit_project_content" style="width: 40%;">
					<text class='planAudit_project_text'>所属方案名称</text>
					<text class='planAudit_project_text'>计划检查时间</text>
					<text class='planAudit_project_text'>检查对象</text>
					<text class='planAudit_project_text'>当前任务节点</text>
				</view>
				<view class="planAudit_project_content" style="width: 60%;">
					<text class='planAudit_project_text'>{{item.schemeName}}</text>
					<text class='planAudit_project_text'>{{item.inspTime?item.inspTime:'无'}}</text>
					<text class='planAudit_project_text'>{{item.inspObjName}}</text>
					<text class='planAudit_project_text' v-if="tabsIndex==0" @click="maintenanceClick(index)"
						style="color:#1590EF;">{{item.taskStatusName}}</text>
					<text class='planAudit_project_text' v-else>{{item.taskStatusName}}</text>
				</view>
			</view>

		</view>
	</view>
</template>

<script>
	import * as api from '@/common/api/supervise.js'
	export default {
		components: {

		},
		data() {
			return {
				keyword: "",
				options: {},
				checkTask: {},
				list1: [{
					name: '检查中',
				}, {
					name: '已检查',
				}],
				tabsIndex: 0,
				page: {
					"current": 1,
					"size": 99999
				}
			}
		},
		onLoad(option) {
			if (option.direction == 2) {
				this.options = JSON.parse(option.formSearch)
			} else {
				this.options = option
			}
		},
		// onShow() {
		// 	uni.$on('revname', (res) => {
		// 		console.log(res, '从C页面传递的数据')
		// 	})
		// },
		mounted() {
			this.search(1)
		},
		methods: {
			search(index) {
				this.options.taskStatus = index
				api.default.getCheckTaskList({
					...this.options,
					...this.page
				}).then(res => {
					this.checkTask = res.data.data.records

				})
			},
			// 导航切换
			recordClick(itme) {
				this.tabsIndex = itme.index
				if (itme.index == 0) {
					this.search(1)
				} else {
					this.search(2)
				}

			},


			//检查结果记录跳转
			maintenanceClick(index) {
				this.$goBack('./recordMaintenance?taskId=' + this.checkTask[index].taskId, 2);
			},

			// // 我的任务查询跳转
			focusSearch() {
				this.$goBack('./processSearch?&schemeId=' + this.options.schemeId, 5);
			}
		}
	}
</script>

<style lang="scss" scoped>
	.planAudit {
		width: 100%;

		.planAudit_project {
			margin: 20rpx 35rpx;
			background-color: white;
			border-bottom: 1px #F2F2F2 solid;

			.planAudit_project_title {
				width: 100%;
				padding: 10px 0;
				display: inline-block;

				.planAudit_project_img {
					width: 30rpx;
					height: 40rpx;
					margin: 0 25rpx 0 20rpx;
					vertical-align: middle
				}
			}

			.planAudit_project_content {
				display: inline-block;
				margin: 10px 0;

				.planAudit_project_text {
					width: 100%;
					display: block;
					margin: 20rpx;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis
				}
			}
		}
	}
</style>
